<%@ page contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isErrorPage="true" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <title>登录页面</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../layui-v2.5.7/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../layui-v2.5.7/style/admin.css" media="all">
    <link rel="stylesheet" href="../layui-v2.5.7/style/login.css" media="all">
    <script src="../layui-v2.5.7/layui/layui.js"></script>
    <style>
        body {
            background-color: #D9AFD9;
            background-image: linear-gradient(218deg, #D9AFD9 0%, #97D9E1 100%);
            height: 750px;
        }
    </style>
</head>
<body>

<div class="layadmin-user-login layadmin-user-display-show" id="app" style="display: none;">

    <form class="layadmin-user-login-main" action="${pageContext.request.contextPath}/login" method="post">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>校园纸质资料处理系统</h2>
            <p >用户登录</p>
            <p style="color: red">${loginError}</p>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username"
                       for="LAY-user-login-username"></label>
                <input type="text" name="uname" id="LAY-user-login-username" lay-verify="required" placeholder="用户名"
                       class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password"
                       for="password"></label>
                <input type="password" name="password" id="password" lay-verify="required"
                       placeholder="密码" class="layui-input">
            </div>
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs6">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"
                               for="LAY-user-login-vercode"></label>
                        <input type="text" name="code" id="LAY-user-login-vercode" lay-verify="required"
                               placeholder="图形验证码" class="layui-input">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 15px;">
                            <img id="checkCode" style="width: 150px; height: 50px;" src="/code" alt="验证码生成失败"/>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
            </div>
            <div class="layui-trans layui-form-item layadmin-user-login-other">
                <a href="register.jsp" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
            </div>
        </div>
    </form>
</div>

<script>
    //加载form模块
    layui.use('form', function () {
        let form = layui.form;
    });
    /*获取验证码图片*/
    window.onload = function () {
        /*获取图片对象*/
        let img = document.getElementById("checkCode");
        /*绑定点击事件*/
        img.onclick = function () {
            img.src = "/code?" + new Date().getTime();
        }
    }
</script>
</body>
</html>
